home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 12 - 1996 / 12.11 Nov 96 / Getting Started / GridLayout 2 / GridLayout.java < prev    next >
Encoding:
Java Source  |  1996-08-31  |  336 b   |  18 lines  |  [TEXT/CWIE]

  1. import java.awt.*;
  2.  
  3. public class MyGrid extends java.applet.Applet
  4. {
  5.     int        numButtons;
  6.     String    att;
  7.     
  8.     public void init()
  9.     {
  10.         att = getParameter( "NUMBUTTONS" );
  11.         numButtons = Integer.valueOf(att).intValue();
  12.         
  13.         setLayout( new GridLayout( 2, 20, 5, 20 ) );
  14.         
  15.         for ( int i=1; i<=numButtons; i++ )
  16.             add( new Button( ""+i ) );
  17.     }
  18. }